<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<title>设备列表</title>

    <script type="text/javascript">
        var APPVERSION = Date.now();
        document.write('<link rel="stylesheet" href=\"\/aigo\/css\/devicelist.css?v='+APPVERSION+'\">');
        document.write('<link rel="stylesheet" href=\"\/aigo\/css\/reset.css?v='+APPVERSION+'\">');
    </script>

</head>
<body>
<div class="main-view">
	<div class="device_body">
		<div class="devictype">
			<span>我的设备</span>
		</div>
		<section class="list">
		<ul class="list-ul">
			<#if devicebindlist??>
				<#list devicebindlist as data>
					<#if data.btype = 8>
						<li class="itemWipe">
							<div class="con"  onclick="javascript:window.location.href='/wx/device/deviceset/${(data.id)!}'">${(data.udname)!}
							</div>
							<span class="fx" onclick="fx(${(data.id)!});">分享</span>
							<span class="zj" onclick="zj(${(data.id)!});">自检</span>
							<div class="btn" onclick="delect(${(data.id)!});">删除</div>
						</li>
					</#if>
				</#list>
			</#if>					
		</ul>
		</section>
	</div>
	<div class="device_body otherdevice">
		<div class="otherd">
			<span>其他设备</span>
		</div>
		<section class="list">
		<ul class="list-ul">
			<#if devicebindlist??>
				<#list devicebindlist as data>
					<#if data.btype = 0>
						<li class="itemWipe">
							<div class="con">${(data.udname)!}
							<span class="zj" onclick="zj(${(data.id)!});">自检</span>
							</div>
							<div class="btn" onclick="delect(${(data.id)!});">删除</div>
						</li>
					</#if>
				</#list>
			</#if>			
		</ul>
		</section>
	</div>
	<div class="dbottom"><div id="adddeivice">+</div></div>
<div class="dele">
	<ul>
		<li class="title">删除后历史数据会被清空<br/>是否删除？</li>
		<li class="delet">删除</li>
		<li class="qx">取消</li>
	</ul>
</div>	
</div>
<script>
	document.write('<script src=\"\/aigo\/js\/zept.js?v=' + APPVERSION + '\"><\/script>')
	document.write('<script src=\"\/aigo\/js\/fastclick.js?v=' + APPVERSION + '\"><\/script>')
    document.write('<script src=\"\/aigo\/js\/zepto.min.js?v=' + APPVERSION + '\"><\/script>')
</script>
 <script type="text/javascript">
   $(function() {
     $('.itemWipe').touchWipe({itemDelete: '.btn'});
	 $(".qx").click(function(){
	   hdied();
	 });
	 $(".delet").click(function(){
		var deleid = $(this).attr("id");
		var did = deleid.split("_")[1];
		$.ajax({
            type: "POST",
            url: "/wx/deletbind/"+did,
            data: {},
            success: function(res) { 
                if (res.msg == '1') {
                	location.reload(); 
                	alert("删除成功！");
                	hdied();
                } else {
                	showtols("删除失败！");
                }
            }
        });
		
	 })
     });
	function delect(deviceid){
	  $(".delet").attr("id","did_"+deviceid);
      $(".dele").show();
	  $(".dele ul").css({"height":"190px"});
	}
	function hdied(){
	   $(".dele").hide();
	   $(".dele ul").css({"height":"0px"});
	}
	/*设备自检 */
	function zj(deviceid){
		window.location.href="/wx/device/dtest/"+deviceid;
	}
	/* 分享设备 */
	function fx(deviceid){
		window.location.href="/wx/device/shadivce/"+deviceid;
	}
 </script>
</body>
</html>